
********USE database_table_9_figures_5_6.dta

drop delta_new_concessions  delta_interest_rate mean_delta_interest_rate_bef mean_delta_interest_rate_af mean_delta_new_concessions_bef mean_delta_new_concessions_af mean_delta_new_concessions mean_delta_interest_rate data2

gen data2=data^2
gen delta_new_concessions= newloanspersonalcredit- newloansautomobile
label variable delta_new_concessions �Delta Concessions�
gen delta_interest_rate=  yearratepersonal-  yearrateauto
label variable delta_new_concessions �Delta Interest Rate�

egen mean_delta_interest_rate_bef= mean(delta_interest_rate) if dummy_law==0
replace mean_delta_interest_rate_bef = 0 if dummy_law==1
egen mean_delta_interest_rate_af= mean(delta_interest_rate) if dummy_law==1
replace mean_delta_interest_rate_af = 0 if dummy_law==0

egen mean_delta_new_concessions_bef= mean(delta_new_concessions) if dummy_law==0
replace mean_delta_new_concessions_bef= 0 if dummy_law==1
egen mean_delta_new_concessions_af= mean(delta_new_concessions) if dummy_law==1
replace mean_delta_new_concessions_af= 0 if dummy_law==0

gen mean_delta_new_concessions= mean_delta_new_concessions_af+ mean_delta_new_concessions_bef


gen mean_delta_interest_rate= mean_delta_interest_rate_bef+ mean_delta_interest_rate_af
label variable  mean_delta_interest_rate  �Mean Delta Interest Rate�

*Figure 6

twoway (line delta_new_concessions data) (scatter mean_delta_new_concessions data), ytitle(R$ Billions) xtitle(aa) title(Fig. 6 Difference in Monthly Concessions) subtitle(Personal minus  Automobile) caption(Source: Banco Central do Brasil) legend(on stack rows(3) position(10) ring(0))

*Figure 5

twoway (line delta_interest_rate data) (scatter mean_delta_interest_rate data), ytitle(R$ Billions) xtitle(, size(zero)) title(Fig. 5 Difference in Monthly Concessions) subtitle(Personal minus  Automobile) caption(Source: Banco Central do Brasil) legend(on stack rows(3) position(1) ring(0))


*Table 9

*Column 1
newey  delta_new_concessions dummy_law,lag(2)

*Column 2

newey  delta_new_concessions data dummy_law,lag(2)

*Column 3

newey  delta_new_concessions data data2 dummy_law,lag(2)

*Column 4

newey  delta_interest_rate dummy_law,lag(2)

*Column 5

newey  delta_interest_rate data dummy_law,lag(2)

*Column 6

newey  delta_interest_rate data data2 dummy_law,lag(2)

drop delta_new_concessions  delta_interest_rate mean_delta_interest_rate_bef mean_delta_interest_rate_af mean_delta_new_concessions_bef mean_delta_new_concessions_af mean_delta_new_concessions mean_delta_interest_rate data2

